(() => {
    return {
        name: "mxdm123",
        description: "xxxxxx",
        version: "1.0.0",
        author: "mxdm123",
        search: {
            url: "https://www.mxdm123.com/vodsearch/-------------/?wd={keyword}",
            description: "获取搜索列表",
            parse: function (html) {
                const $ = cheerio.load(html);
                const listItems = $(".module-items .module-item")
                    .map((index, element) => {
                        // 或者获取元素的特定属性
                        const href = $(element).find(".module-card-item-title a").attr("href");
                        const title = $(element).find(".module-card-item-title").text().trim();
                        const thumbnail = $(element).find(".module-item-pic img").data("original");
                        const score = $(element).find(".pic-tag-top").text().trim();
                        // 返回你需要的数据结构
                        return {
                            title,
                            href: "https://www.mxdm123.com" + href,
                            thumbnail,
                            score: '--',
                            source: "lzrs",
                        };
                    })
                    .get();
                return listItems;
            },
        },
        detail: {
            description: "详情页面，获取播放地址",
            parse: function (html) {
                const $ = cheerio.load(html);
                const playUrl = $('.module-info-content').find(".module-info-play a").attr("href");
                return "https://www.mxdm123.com" + playUrl;
            },
        },
        play: {
            description: "播放页面，获取真实播放地址",
            mediaType: "iframe",
            parseType: "html",
            parse: function (html) {
                const parser = new DOMParser();
                const doc = parser.parseFromString(html, 'text/html');
                const scriptTags = doc.querySelectorAll('script');
                let target = '';
                scriptTags.forEach(script => {
                    if (script.textContent && script.textContent.trim() !== '' && script.textContent.includes('player_aaaa')) {
                        target = `
                            (()=>{
                            ${script.textContent};
                            return player_aaaa;
                            })()
                                        `
                    }
                });
                const a = eval(target);
                return a.url;
            },
        },
    };
})()